-
Notifications
You must be signed in to change notification settings - Fork 13
Change from aiohttp to httpx #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #598 +/- ##
==========================================
+ Coverage 96.20% 96.31% +0.10%
==========================================
Files 29 29
Lines 1870 1870
==========================================
+ Hits 1799 1801 +2
+ Misses 71 69 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Standardize on httpx by replacing aiohttp-based clients and retries with httpx.AsyncClient and httpx_retries.
- Swap out
aiohttp.ClientSession
/RetryClient
forhttpx.AsyncClient
withRetryTransport
- Update all response checks to use
status_code
and JSON decoding to useJSONDecodeError
- Adjust tests to mock httpx client methods and remove context‐manager mocks
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/test_servicex_adapter.py | Mocked ClientSession.get/post/delete , switched to JSONDecodeError |
servicex/servicex_adapter.py | Replaced aiohttp imports and retries with httpx client and retry transport |
pyproject.toml | Removed aiohttp-retry dependency, added httpx_retries |
Comments suppressed due to low confidence (1)
servicex/servicex_adapter.py:53
- httpx.Response.json() is synchronous, so
await r.json()
will error; callr.json()
directly (and similarly removeawait
for other.json()
calls).
o = await r.json()
error_message = await _extract_message(r) | ||
raise RuntimeError( | ||
"ServiceX WebAPI Error during transformation " | ||
f"submission: {r.status_code} - {error_message}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error raised in get_transforms
mentions 'submission' but this method retrieves transforms; update the message to reflect retrieval (e.g., 'retrieval').
f"submission: {r.status_code} - {error_message}" | |
f"retrieval: {r.status_code} - {error_message}" |
Copilot uses AI. Check for mistakes.
import httpx | ||
from aiohttp_retry import RetryClient, ExponentialRetry, ClientResponse | ||
from aiohttp import ContentTypeError | ||
from httpx import AsyncClient as ClientSession, Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Aliasing httpx.AsyncClient
as ClientSession
can be confusing given its similarity to aiohttp; consider using a distinct alias like AsyncClient
for clarity.
from httpx import AsyncClient as ClientSession, Response | |
from httpx import AsyncClient, Response |
Copilot uses AI. Check for mistakes.
We were using both aiohttp and httpx for connections to the backend. Standardize on httpx (which has, currently, better free-thread support).